//引入路由组件
//@表示src文件夹
import MyHome from '@/pages/MyHome'
import MyLogin from '@/pages/MyLogin'
import MyRegister from '@/pages/MyRegister'
import MySearch from '@/pages/MySearch'
import MyDetail from '@/pages/MyDetail'
import AddCartSuccess from '@/pages/AddCartSuccess'
import ShopCart from '@/pages/ShopCart'

export default [
    {
        path:"/shopcart",
        component:ShopCart,
        meta:{show:true}
    },
    {
        path:"/addcartsuccess",
        name:"addcartsuccess",
        component:AddCartSuccess,
        meta:{show:true}
    },
    {
        path:"/detail/:skuid",
        component:MyDetail,
        meta:{show:true}
    },
    {
        path:"/home",
        component:MyHome,
        meta:{show:true}
    },
    {
        path:"/login",
        component:MyLogin,
        meta:{show:false}

    },
    {
        path:"/register",
        component:MyRegister,
        meta:{show:false}
        
    },
    {
        path:"/search/:keyword?",
        name:'search',
        component:MySearch,
        meta:{show:true},
        //利用props传参 常用函数写法 可以把params参数、query参数 通过props传递给路由组件
        /* props:()=>{
            return{
                keyword:$route.params.keyword,k:$route.query.k

            }
        } */
        


    },
    //重定向，在项目跑起来的时候，访问/,立马让它定位到首页
    {
        path:"*",
        redirect:"/home"
    }
]